home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_aet_sprpulse.cog < prev    next >
Text File  |  1999-11-15  |  4KB  |  152 lines

  1. # Jones 3D Cog Script
  2. #
  3. # aet_SprPulse.cog
  4. #
  5. # Produces the effect of a track of strobing lights all in a row.  May be used for different patterns.
  6. #
  7. # [TL] [RD]
  8. #
  9. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11. symbols
  12.  
  13. message    startup
  14. message    pulse
  15. message    crossed
  16. message    user0                    # message begining pulse if needed
  17. message    user1                   # message ending pulse if needed
  18.  
  19. thing    light0=-1        local    # throw-away for [index] use
  20. thing    light1
  21. thing    light2
  22. thing    light3
  23. thing    light4
  24. thing    light5
  25. thing    light6
  26. thing    light7
  27. thing    light8
  28. thing    light9
  29. thing    light10
  30.  
  31. cog        offspring                # next cog in the string for more than 10 lights
  32.  
  33. surface    adjoinOn                # turns on lights
  34. surface    adjoinOff                # turns off lights
  35.  
  36. flex    valXoff=0.1                # smallest size of X axis value
  37. flex    valYoff=0.1             # smallest size of Y axis value
  38. flex    valAoff=0.1             # smallest amount of alpha value
  39. flex    valXon=0.5                # largest size of X axis value
  40. flex    valYon=0.5              # largest size of Y axis value
  41. flex    valAon=0.5              # largest amount of alpha value
  42. flex    fadetime=1.0            # amount of time it takes a light to fade from off to on or vice versa
  43. flex    pulsetime=1.0            # amount of time between pulses (this number must be >= fadetime)
  44.  
  45. vector    vecoff            local
  46. vector    vecon            local
  47.  
  48. int        cnt                local
  49. int        indexadd=1                # change this number to change pattern of light pulses (i.e. skip lights)
  50. int        lightnum=10                # number of highest attached light (i.e. light9 == 9)
  51. int        index=0                    # change number to start pulse on light other than lowest attached light
  52. int        parent=1                # 1 == first cog to start string of pulses, 0 == not first cog to start string
  53. int        nullvalue        local
  54.  
  55. end
  56.  
  57. # ========================================================================================
  58. code
  59.  
  60. startup:
  61.  
  62. # turning all of the sprites off at start up
  63. for (cnt = 0; cnt <= lightnum; cnt = cnt + 1)
  64.     {
  65.     if (light0[cnt] > 0)
  66.         {
  67.         nullvalue = AnimateSpriteSize(light0[cnt], '0 0 0', '0 0 0', 0);
  68.         }
  69.     }
  70. # if this cog is not the first in the string, then don't turn on the pulse at startup 
  71. if (parent == 0) return;
  72. # checking to see if any adjoins are attached to the cog, if not, then calls user0 to start pulse
  73. if (adjoinOn == -1)
  74.     {
  75.     call user0;
  76.     }
  77.  
  78. return;
  79.  
  80. # ........................................................................................
  81. crossed:
  82.  
  83. # calls user0 to start pulse if On adjoin is crossed
  84. if (GetSenderRef() == adjoinOn)
  85.     {
  86.     call user0;
  87.     }
  88. # calls user1 to stop pulse if Off adjoin is crossed
  89. if (GetSenderRef() == adjoinOff)
  90.     {
  91.     call user1;
  92.     }
  93.  
  94. return;
  95.  
  96. # ........................................................................................
  97. user0:
  98.  
  99. # starts lights pulsing and asigns values to sprite size and alpha 
  100. vecoff = VectorSet(valXoff, valYoff, valAoff);
  101. vecon = VectorSet(valXon, valYon, valAon);
  102.  
  103. //AnimateSpriteSize(light0[index], vecoff, vecon, fadetime);
  104.  
  105. SetPulse(pulsetime);
  106.  
  107. return;
  108.  
  109. # ........................................................................................
  110. pulse:
  111.  
  112. # actual pulsing mechanism for lights
  113. # checks to see if some lights are NOT attatched and skips those index numbers
  114. if (light0[index] != -1)
  115.     {
  116.     nullvalue = AnimateSpriteSize(light0[index], vecon, vecoff, fadetime);
  117.     }
  118. # sets the index number ahead the indexadd amount to tell the cog the next sprite to be faded up
  119. index = index + indexadd;
  120.  
  121. # once the index number is greater than the total number of lights...
  122. if (index > lightnum)
  123.     {
  124.     index = index - lightnum;
  125.     if (offspring != -1)
  126.         {
  127.         call user1;
  128.         SendMessage(offspring, user0);
  129.         return;
  130.         }
  131.     }
  132.  
  133. # checks to see if some lights are NOT attatched and skips those index numbers
  134. if (light0[index] != -1)
  135.     {
  136.     nullvalue = AnimateSpriteSize(light0[index], vecoff, vecon, fadetime);
  137.     }
  138.  
  139. return;
  140.  
  141. # ........................................................................................
  142. user1:
  143.  
  144. # turns off pulse and sets last of the sprites off...currently a small BUG in this code...
  145. //AnimateSpriteSize(light0[index], vecon, vecoff, fadetime);
  146. SetPulse(0);
  147.  
  148. return;
  149.  
  150. # ........................................................................................
  151. end
  152.